//
//  NQUserInfoCell.m
//  ZLFastDoctor
//
//  Created by 李岚清 on 16/5/23.
//  Copyright © 2016年 LS. All rights reserved.
//

#import "NQUserInfoCell.h"
#define MAS_SHORTHAND
#define MAS_SHORTHAND_GLOBALS
#import <Masonry/Masonry.h>

@interface NQUserInfoCell ()
/**
 *  记录个人信息结果
 */
@property (nonatomic, strong) UILabel *infoLabel;

@end

@implementation NQUserInfoCell
#pragma mark - set/get
- (void)setInfoType:(NSString *)infoType{
    _infoType = infoType;
    //赋值个人信息类型
    self.textLabel.text = infoType;
}

- (void)setInfoResult:(NSString *)infoResult{
    _infoResult = infoResult;
    //赋值个人信息结果
    self.infoLabel.text = infoResult;
}

#pragma mark - 重写构造方法
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setupUI];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder{
    if (self = [super initWithCoder:aDecoder]) {
        [self setupUI];
    }
    return self;
}

#pragma mark - 添加子控件及约束
- (void)setupUI{
    //cell基本设置
    self.textLabel.textColor = [UIColor lightGrayColor];
    self.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    //添加子控件
    [self.contentView addSubview:self.infoLabel];
    //设置约束
    [self.infoLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.contentView.right).offset(-90);
        make.centerY.equalTo(self.contentView);
    }];
    [self.contentView makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.right.equalTo(self);
    }];
}

#pragma mark - 懒加载子控件
- (UILabel *)infoLabel{
    if (!_infoLabel) {
        _infoLabel = [[UILabel alloc] init];
        _infoLabel.text = @"cm";
        _infoLabel.textColor = [UIColor lightGrayColor];
        _infoLabel.font = [UIFont systemFontOfSize:18];
        _infoLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _infoLabel;
}


@end
